package dao.ejb3;
// Generated 21-mag-2009 14.05.26 by Hibernate Tools 3.2.0.CR1


import h8model.ejb3.AppUser;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Home object for domain model class AppUser.
 * @see h8model.AppUser
 * @author Hibernate Tools
 */
@Stateless
public class AppUserHome {

    private static final Log log = LogFactory.getLog(AppUserHome.class);

    @PersistenceContext private EntityManager entityManager;
    
    public void persist(AppUser transientInstance) {
        log.debug("persisting AppUser instance");
        try {
            entityManager.persist(transientInstance);
            log.debug("persist successful");
        }
        catch (RuntimeException re) {
            log.error("persist failed", re);
            throw re;
        }
    }
    
    public void remove(AppUser persistentInstance) {
        log.debug("removing AppUser instance");
        try {
            entityManager.remove(persistentInstance);
            log.debug("remove successful");
        }
        catch (RuntimeException re) {
            log.error("remove failed", re);
            throw re;
        }
    }
    
    public AppUser merge(AppUser detachedInstance) {
        log.debug("merging AppUser instance");
        try {
            AppUser result = entityManager.merge(detachedInstance);
            log.debug("merge successful");
            return result;
        }
        catch (RuntimeException re) {
            log.error("merge failed", re);
            throw re;
        }
    }
    
    public AppUser findById( long id) {
        log.debug("getting AppUser instance with id: " + id);
        try {
            AppUser instance = entityManager.find(AppUser.class, id);
            log.debug("get successful");
            return instance;
        }
        catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }
}

